package test;

import java.awt.Point;
import engine.Collision;
import engine.Sprite;

public class MarioBrickCollision implements Collision {
    private final int FUDGE_FACTOR = 5;
    public void applyCollision(Sprite a, Sprite b) {
        Mario m = (Mario)a;
        //mario hits brick from top
        if (m.getPosition().getY() + m.getBounds().getHeight() < b.getPosition().getY() + FUDGE_FACTOR) {
            m.changeSpeed(new Point(0,0));
            m.setPosition(new Point((int)m.getPosition().getX(), (int)m.getPosition().getY() - 1));
            m.endJump();
        }
    }
}
